$(document).ready(function() {
	var $miaobian = $('.Xcontent08>div');
	var $huantu = $('.Xcontent06>img');
	var $miaobian1 = $('.Xcontent26>div');
	$miaobian.mousemove(function() {
		miaobian(this);
	});
	$miaobian1.click(function() {
		miaobian1(this);
	});

	function miaobian(thisMb) {
		for (var i = 0; i < $miaobian.length; i++) {
			$miaobian[i].style.borderColor = '#dedede';
		}
		thisMb.style.borderColor = '#cd2426';

		$huantu[0].src = thisMb.children[0].src;
	}

	function miaobian1(thisMb1) {
		for (var i = 0; i < $miaobian1.length; i++) {
			$miaobian1[i].style.borderColor = '#dedede';
		}
		//		thisMb.style.borderColor = '#cd2426';
		$miaobian.css('border-color', '#dedede');
		thisMb1.style.borderColor = '#cd2426';
		$huantu[0].src = thisMb1.children[0].src;
	}
	$(".Xcontent33").click(function() {
		var value = parseInt($('.input').val()) + 1;
		$('.input').val(value);
	})

	$(".Xcontent32").click(function() {
		var num = $(".input").val()
		if (num > 0) {
			$(".input").val(num - 1);
		}

	})

});

jQuery(document).ready(function($) {

	$('#etalage').etalage({
		thumb_image_width: 300,
		thumb_image_height: 400,

		show_hint: true,
		click_callback: function(image_anchor, instance_id) {
			alert('Callback example:\nYou clicked on an image with the anchor: "' + image_anchor +
				'"\n(in Etalage instance: "' + instance_id + '")');
		}
	});
	// This is for the dropdown list example:
	$('.dropdownlist').change(function() {
		etalage_show($(this).find('option:selected').attr('class'));
	});

});

$(document).ready(function() {
	$(".dropdown img.flag").addClass("flagvisibility");

	$(".dropdown dt a").click(function() {
		$(".dropdown dd ul").toggle();
	});

	$(".dropdown dd ul li a").click(function() {
		var text = $(this).html();
		$(".dropdown dt a span").html(text);
		$(".dropdown dd ul").hide();
		$("#result").html("Selected value is: " + getSelectedValue("sample"));
	});

	function getSelectedValue(id) {
		return $("#" + id).find("dt a span.value").html();
	}

	$(document).bind('click', function(e) {
		var $clicked = $(e.target);
		if (!$clicked.parents().hasClass("dropdown"))
			$(".dropdown dd ul").hide();
	});


	$("#flagSwitcher").click(function() {
		$(".dropdown img.flag").toggleClass("flagvisibility");
	});
});


/*自动轮播小图*/
$(window).load(function() {
	$("#flexiselDemo1").flexisel();
	$("#flexiselDemo2").flexisel({
		enableResponsiveBreakpoints: true,
		responsiveBreakpoints: {
			portrait: {
				changePoint: 480,
				visibleItems: 1
			},
			landscape: {
				changePoint: 640,
				visibleItems: 2
			},
			tablet: {
				changePoint: 768,
				visibleItems: 3
			}
		}
	});

	$("#flexiselDemo3").flexisel({
		visibleItems: 5,
		animationSpeed: 1000,
		autoPlay: true,
		autoPlaySpeed: 3000,
		pauseOnHover: true,
		enableResponsiveBreakpoints: true,
		responsiveBreakpoints: {
			portrait: {
				changePoint: 480,
				visibleItems: 1
			},
			landscape: {
				changePoint: 640,
				visibleItems: 2
			},
			tablet: {
				changePoint: 768,
				visibleItems: 3
			}
		}
	});

});
